#include "common.h"
#include <QFile>
#include <QApplication>
#include <QVariant>
#include "mainwindow.h"

Common* Common::m_pInstance = new Common;
Common::Common(QObject *parent) : QObject(parent)
{

}

void Common::setMainWindow(MainWindow* pMain)
{
    m_pMain = pMain;
}

MainWindow *Common::getMainWindow()
{
    return m_pMain;
}

void Common::setBackgroundImage(QString img)
{
    m_bkImg = img;
}

QString Common::getBackgroundImage()
{
    return m_bkImg;
}

void Common::setMainWinOpacity(int opacity)
{
    m_mainWinOpacity = opacity;
}

int Common::getMainWinOpacity()
{
    return m_mainWinOpacity;
}

Common *Common::getInstance()
{
    return m_pInstance;
}

void Common::setStyle(const QString &style)
{
    QFile qss(style);
    qss.open(QIODevice::ReadOnly);
    qApp->setStyleSheet(qss.readAll());
    qss.close();
}

void Common::printLog(QVariant value)
{
#ifndef _DEBUG_
    qDebug() << "File=[ " << __FILE__
             << " ], Function=[ " << __FUNCTION__
             << " ], Line=[ " << __LINE__
             << " ], Info=[ " << value<< " ]";
#endif
}
